#pragma once
#include "DataSQL.h"
class CSqlTable
{
	//Constructor and Destroy

public:
	CSqlTable();
	CSqlTable(CString sName);
	~CSqlTable(void);

public:
	static bool connectToServer();
	static bool connectToDatabase();
	static bool createDatabase(CString sDatabase);
	static bool createTable(CString sDatabase, CString sTable);
	static bool importFromFile(CString sFile);
	static bool insertRecord(int nTable,CString sValue);
	static bool insertRecord(const CString&sTable,CString sValue);
	bool updateRecord(CString sQurey);
	bool deleteRecord(CString sQurey);
	static bool getField(int nPosTbl,std::vector<CString> &vtField , std::vector<int> &vtType);
	CString getPrimerKey();
	
	static bool getTableList(vector<CString> &vtTables);
	static bool deleteDatabase(const CString& sDatabase);
	static bool deleteAllRecord(const CString& sTable);

	static bool updateInfCompany(const int& nId,const CString& sName,const CString& sAdd,const CString& sPhone,const CString&sEmail,const CString& sTax,const CString& sNote,bool bUpdate);
	static bool getInfCompany(const int& nId,CString& sName,CString& sAdd,CString& sPhone,CString&sEmail,CString& sTax,CString& sNote);
	static bool getNameCompany(CString &sName);
	
	static bool getFunctionCompany(vector<CString>& vtName, vector<CString>& vtNote);
	static bool addFunctionCompany(const CString& sCode,const CString& sName, const CString& sNote);	

	static CString getTableAt(int nPos);
	CString getFielName(const CString& sTable,int nPos);
	CString getFormatFromType(int nType);

	static bool isEmpty(const CString& sTable,const CString& sKey);


public:
	static CString m_sName;
	static std::vector<CString> m_vtTable;
	static CString m_sDataBase;

};